/**
 * Copyright (c) 2021 OceanBase
 * OceanBase CE is licensed under Mulan PubL v2.
 * You can use this software according to the terms and conditions of the Mulan PubL v2.
 * You may obtain a copy of Mulan PubL v2 at:
 *          http://license.coscl.org.cn/MulanPubL-2.0
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PubL v2 for more details.
 */

#ifndef OCEANBASE_SQL_OPTIMIZER_OB_OPT_EST_PARAMETER_NORMAL_
#define OCEANBASE_SQL_OPTIMIZER_OB_OPT_EST_PARAMETER_NORMAL_
#include "ob_opt_est_cost_model.h"

namespace oceanbase
{
namespace sql
{

const static double NORMAL_CPU_TUPLE_COST = 0.02977945030613315927249275026;
const static double NORMAL_TABLE_SCAN_CPU_TUPLE_COST = 0.3717749711890249146505031527;
const static double NORMAL_MICRO_BLOCK_SEQ_COST = 4.12032943880540981;
const static double NORMAL_MICRO_BLOCK_RND_COST = 5.45276187553;
const static double NORMAL_PROJECT_COLUMN_SEQ_INT_COST = 0.04392826667;
const static double NORMAL_PROJECT_COLUMN_SEQ_NUMBER_COST = 0.04187649999657894736842105263;
const static double NORMAL_PROJECT_COLUMN_SEQ_CHAR_COST = 0.001149576877742598684210526316;
const static double NORMAL_PROJECT_COLUMN_RND_INT_COST = 0.08879689693065789473684210526;
const static double NORMAL_PROJECT_COLUMN_RND_NUMBER_COST = 0.07463286534828947368421052632;
const static double NORMAL_PROJECT_COLUMN_RND_CHAR_COST = 0.002145698273026315789473684210;
const static double NORMAL_FETCH_ROW_RND_COST = 2.2477466668;
const static double NORMAL_CMP_INT_COST = 0.0100087103407539;
const static double NORMAL_CMP_NUMBER_COST = 0.0227412012152380952380952381;
const static double NORMAL_CMP_CHAR_COST = 0.09707028746051587301587301588;
const static double NORMAL_CMP_SPATIAL_COST = 19.311884382850465;
const static double NORMAL_INVALID_CMP_COST = -1;
const static double NORMAL_HASH_INT_COST = 0.02272897981269841269841269841;
const static double NORMAL_HASH_NUMBER_COST = 0.02702563229230158730158730158;
const static double NORMAL_HASH_CHAR_COST = 0.2306996323278174603174603175;
const static double NORMAL_INVALID_HASH_COST = -1;
const static double NORMAL_MATERIALIZE_PER_BYTE_WRITE_COST = 0.0003799844906944444444444444444;
const static double NORMAL_READ_MATERIALIZED_PER_ROW_COST = 0.08075845740444444444444444444;
const static double NORMAL_PER_AGGR_FUNC_COST = 0.03295337962222222222222222222;
const static double NORMAL_PER_WIN_FUNC_COST = 0.4276335555833333333333333333;
const static double NORMAL_CPU_OPERATOR_COST = 0.03295337962222222222222222222;
const static double NORMAL_JOIN_PER_ROW_COST = 0.2924230170039462058068723292;
const static double NORMAL_BUILD_HASH_PER_ROW_COST = 0.2518499446975396825396825399;
const static double NORMAL_PROBE_HASH_PER_ROW_COST = 0.2320765365033553814947149724;
const static double NORMAL_RESCAN_COST = 0.7380813333;
const static double NORMAL_NETWORK_SER_PER_BYTE_COST = 0.0094539370039375;
const static double NORMAL_NETWORK_DESER_PER_BYTE_COST = 0.0094539370039375;
const static double NORMAL_NETWORK_TRANS_PER_BYTE_COST = 0.011832508338;
const static double NORMAL_PX_RESCAN_PER_ROW_COST = 398.267410467;
const static double NORMAL_PX_BATCH_RESCAN_PER_ROW_COST = 49.5841472833;
const static double NORMAL_NL_SCAN_COST = 19.2;
const static double NORMAL_BATCH_NL_SCAN_COST = 16.11;
const static double NORMAL_NL_GET_COST = 8.24;
const static double NORMAL_BATCH_NL_GET_COST = 6.76;
const static double NORMAL_TABLE_LOOPUP_PER_ROW_RPC_COST = 20.9591092914652749211572741;
const static double NORMAL_INSERT_PER_ROW_COST = 6.330037500000001;
const static double NORMAL_INSERT_INDEX_PER_ROW_COST = 6.583673124999999;
const static double NORMAL_INSERT_CHECK_PER_ROW_COST = 96.2424;
const static double NORMAL_UPDATE_PER_ROW_COST = 7.562755000000001;
const static double NORMAL_UPDATE_INDEX_PER_ROW_COST = 23.969286875;
const static double NORMAL_UPDATE_CHECK_PER_ROW_COST = 92.15352;
const static double NORMAL_DELETE_PER_ROW_COST = 5.0310162499999995;
const static double NORMAL_DELETE_INDEX_PER_ROW_COST = 6.549611874999999;
const static double NORMAL_DELETE_CHECK_PER_ROW_COST = 59.4583275;
const static double NORMAL_SPATIAL_PER_ROW_COST = 3.2434868757557513;
const static double NORMAL_RANGE_COST = 2.1;

const static double comparison_params_normal[ObMaxTC+1] = {
  NORMAL_CMP_INT_COST,            // null
  NORMAL_CMP_INT_COST,            // int8, int16, int24, int32, int64.
  NORMAL_CMP_INT_COST,            // uint8, uint16, uint24, uint32, uint64.
  NORMAL_CMP_INT_COST,            // float, ufloat.
  NORMAL_CMP_INT_COST,            // double, udouble.
  NORMAL_CMP_NUMBER_COST,         // number, unumber.
  NORMAL_CMP_INT_COST,            // datetime, timestamp.
  NORMAL_CMP_INT_COST,            // date
  NORMAL_CMP_INT_COST,            // time
  NORMAL_CMP_INT_COST,            // year
  NORMAL_CMP_CHAR_COST,           // varchar, char, varbinary, binary.
  NORMAL_CMP_INT_COST,            // extend
  NORMAL_INVALID_CMP_COST,        // unknown
  NORMAL_CMP_CHAR_COST,           // TinyText,MediumText, Text ,LongText
};

const static double hash_params_normal[ObMaxTC+1] = {
  NORMAL_HASH_INT_COST,            // null
  NORMAL_HASH_INT_COST,            // int8, int16, int24, int32, int64.
  NORMAL_HASH_INT_COST,            // uint8, uint16, uint24, uint32, uint64.
  NORMAL_HASH_INT_COST,            // float, ufloat.
  NORMAL_HASH_INT_COST,            // double, udouble.
  NORMAL_HASH_NUMBER_COST,         // number, unumber.
  NORMAL_HASH_INT_COST,            // datetime, timestamp.
  NORMAL_HASH_INT_COST,            // date
  NORMAL_HASH_INT_COST,            // time
  NORMAL_HASH_INT_COST,            // year
  NORMAL_HASH_CHAR_COST,           // varchar, char, varbinary, binary.
  NORMAL_HASH_INT_COST,            // extend
  NORMAL_INVALID_HASH_COST,        // unknown
  NORMAL_HASH_CHAR_COST,           // TinyText,MediumText, Text ,LongText
};

const static ObOptEstCostModel::ObCostParams cost_params_normal(
    NORMAL_CPU_TUPLE_COST,
    NORMAL_TABLE_SCAN_CPU_TUPLE_COST,
    NORMAL_MICRO_BLOCK_SEQ_COST,
    NORMAL_MICRO_BLOCK_RND_COST,
    NORMAL_PROJECT_COLUMN_SEQ_INT_COST,
    NORMAL_PROJECT_COLUMN_SEQ_NUMBER_COST,
    NORMAL_PROJECT_COLUMN_SEQ_CHAR_COST,
    NORMAL_PROJECT_COLUMN_RND_INT_COST,
    NORMAL_PROJECT_COLUMN_RND_NUMBER_COST,
    NORMAL_PROJECT_COLUMN_RND_CHAR_COST,
    NORMAL_FETCH_ROW_RND_COST,
    NORMAL_CMP_INT_COST,
    NORMAL_CMP_NUMBER_COST,
    NORMAL_CMP_CHAR_COST,
    NORMAL_CMP_SPATIAL_COST,
    NORMAL_INVALID_CMP_COST,
    NORMAL_HASH_INT_COST,
    NORMAL_HASH_NUMBER_COST,
    NORMAL_HASH_CHAR_COST,
    NORMAL_INVALID_HASH_COST,
    NORMAL_MATERIALIZE_PER_BYTE_WRITE_COST,
    NORMAL_READ_MATERIALIZED_PER_ROW_COST,
    NORMAL_PER_AGGR_FUNC_COST,
    NORMAL_PER_WIN_FUNC_COST,
    NORMAL_CPU_OPERATOR_COST,
    NORMAL_JOIN_PER_ROW_COST,
    NORMAL_BUILD_HASH_PER_ROW_COST,
    NORMAL_PROBE_HASH_PER_ROW_COST,
    NORMAL_RESCAN_COST,
    NORMAL_NETWORK_SER_PER_BYTE_COST,
    NORMAL_NETWORK_DESER_PER_BYTE_COST,
    NORMAL_NETWORK_TRANS_PER_BYTE_COST,
    NORMAL_PX_RESCAN_PER_ROW_COST,
    NORMAL_PX_BATCH_RESCAN_PER_ROW_COST,
    NORMAL_NL_SCAN_COST,
    NORMAL_BATCH_NL_SCAN_COST,
    NORMAL_NL_GET_COST,
    NORMAL_BATCH_NL_GET_COST,
    NORMAL_TABLE_LOOPUP_PER_ROW_RPC_COST,
    NORMAL_INSERT_PER_ROW_COST,
    NORMAL_INSERT_INDEX_PER_ROW_COST,
    NORMAL_INSERT_CHECK_PER_ROW_COST,
    NORMAL_UPDATE_PER_ROW_COST,
    NORMAL_UPDATE_INDEX_PER_ROW_COST,
    NORMAL_UPDATE_CHECK_PER_ROW_COST,
    NORMAL_DELETE_PER_ROW_COST,
    NORMAL_DELETE_INDEX_PER_ROW_COST,
    NORMAL_DELETE_CHECK_PER_ROW_COST,
    NORMAL_SPATIAL_PER_ROW_COST,
    NORMAL_RANGE_COST
);

}
}
#endif /*OCEANBASE_SQL_OPTIMIZER_OB_OPT_EST_PARAMETER_NORMAL_*/